home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Controls
/
Visual Basic Controls.iso
/
vbcontrol
/
t2win-32
/
_dattim.frm
(
.txt
)
< prev
next >
Wrap
Visual Basic Form
|
1998-07-13
|
32KB
|
509 lines
VERSION 5.00
Begin VB.Form frmDateTime
BorderStyle = 4 'Fixed ToolWindow
Caption = "Date & Time"
ClientHeight = 6495
ClientLeft = 1110
ClientTop = 1365
ClientWidth = 7830
MaxButton = 0 'False
MDIChild = -1 'True
PaletteMode = 1 'UseZOrder
ScaleHeight = 6495
ScaleWidth = 7830
ShowInTaskbar = 0 'False
Begin VB.PictureBox Picture1
Align = 2 'Align Bottom
BorderStyle = 0 'None
Height = 465
Left = 0
ScaleHeight = 465
ScaleWidth = 7830
TabIndex = 4
Top = 6030
Width = 7830
Begin VB.CommandButton Command2
Caption = "&Reset"
Height = 285
Left = 6840
TabIndex = 10
Top = 105
Width = 825
End
Begin VB.TextBox Text1
Height = 285
Left = 1440
TabIndex = 5
Tag = "A/BC/DEF/GHIJ/KLMNOP/"
Top = 90
Width = 5310
End
Begin VB.Label Label1
Caption = "&Enter a test value"
Height = 255
Left = 90
TabIndex = 6
Top = 120
Width = 1275
End
End
Begin VB.Frame Frame1
Height = 570
Left = 0
TabIndex = 1
Top = -90
Width = 7830
Begin VB.CommandButton cmdNP
Caption = ">"
Height = 285
Index = 1
Left = 7470
TabIndex = 9
Top = 195
Width = 285
End
Begin VB.CommandButton cmdNP
Caption = "<"
Height = 285
Index = 0
Left = 6570
TabIndex = 8
Top = 195
Width = 285
End
Begin VB.CommandButton Command1
Caption = "&Go"
Default = -1 'True
Height = 285
Left = 6930
TabIndex = 7
Top = 195
Width = 465
End
Begin VB.ComboBox cmb_Function
Height = 315
Left = 1365
TabIndex = 2
Top = 180
Width = 5115
End
Begin VB.Label Label2
Caption = "&Select a function"
Height = 255
Left = 90
TabIndex = 3
Top = 210
Width = 1275
End
End
Begin VB.TextBox txt_Result
BackColor = &H00C0C0C0&
BorderStyle = 0 'None
Height = 5325
Left = 120
Locked = -1 'True
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 0
Top = 600
Width = 7575
End
Attribute VB_Name = "frmDateTime"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Option Base 1
Private Const Iteration = 250
Dim IsLoaded As Integer
Dim TimerStartOk As Integer
Dim TimerCloseOk As Integer
Dim TimerHandle As Integer
Dim TimerValue As Long
Private Sub cmdNP_Click(Index As Integer)
Text1.Text = ""
Call sub_NextPrev(cmb_Function, Index)
End Sub
Private Sub cmb_Function_Click()
If (IsLoaded = False) Then Exit Sub
Call cDisableFI(mdiT2W.Picture1)
txt_Result = ""
DoEvents
Select Case cmb_Function.ListIndex
Case 0
Call TestDateStatistic
Case 1
Call TestDateConvert
Case 2
Call TestCnvMinuteToTime
Case 3
Call TestCnvMinuteToHundred
Case 4
Call TestCnvTimeToMinute
Case 5
Call TestCnvHundredToMinute
Case 6
Call TestDateHourLong
End Select
DoEvents
Call cEnableFI(mdiT2W.Picture1)
End Sub
Private Sub Form_Activate()
mdiT2W.Label2.Caption = cInsertBlocks(mdiT2W.Label2.Tag, "" & Iteration)
End Sub
Private Sub Form_Load()
IsLoaded = False
Show
Call sub_Load_Combo(cmb_Function, T2WDirInst + "_dattim.t2w")
IsLoaded = True
End Sub
Private Sub Command1_Click()
Call cmb_Function_Click
End Sub
Private Sub TestDateStatistic()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim nYear As Integer
Dim nMonth As Integer
Dim nDay As Integer
Dim nNow As Long
Dim nIntNow As Integer
If (Trim(Text1.Text) = "") Then Text1.Text = Format$(Now, "dd.mm.yyyy")
nNow = cDateToScalar(Val(Format$(Now, "yyyy")), Val(Format$(Now, "mm")), Val(Format$(Now, "dd")))
Call cScalarToDate(nNow, nYear, nMonth, nDay)
strDisplay = "Today is the '" & Text1.Text & "'" & vbCrLf & vbCrLf
strDisplay = strDisplay & "Day of the week (ISO, U.S., Special) is (" & cDayOfWeek(nYear, nMonth, nDay, True) & ", " & cDayOfWeek(nYear, nMonth, nDay, False) & ", " & cDayOfWeek(nYear, nMonth, nDay, 1) & ") (" & cGetLongDay(LNG_ENGLISH, 1 + cDayOfWeek(nYear, nMonth, nDay, False)) & ")" & vbCrLf
strDisplay = strDisplay & "Day of the year is '" & cDayOfYear(nYear, nMonth, nDay) & "'" & vbCrLf
strDisplay = strDisplay & "Week of the year (ISO, U.S., Special) is (" & cWeekOfYear(nYear, nMonth, nDay, True) & ", " & cWeekOfYear(nYear, nMonth, nDay, False) & ", " & cWeekOfYear(nYear, nMonth, nDay, 1) & ")" & vbCrLf & vbCrLf
nNow = cDateToScalar(nYear, nMonth, nDay)
strDisplay = strDisplay & "Scalar day is '" & nNow & "'" & vbCrLf
Call cScalarToDate(nNow, nYear, nMonth, nDay)
strDisplay = strDisplay & "Year : " & nYear & ", Month : " & nMonth & ", Day : " & nDay & vbCrLf & vbCrLf
nIntNow = cDateToInt(nYear, nMonth, nDay)
strDisplay = strDisplay & "Int day is '" & nIntNow & "'" & vbCrLf
Call cIntToDate(nIntNow, nYear, nMonth, nDay)
strDisplay = strDisplay & "Year : " & nYear & ", Month : " & nMonth & ", Day : " & nDay & vbCrLf & vbCrLf
nNow = Int(Now)
nYear = Year(nNow)
nMonth = 1
nDay = 1
strDisplay = strDisplay & "First Day is the '" & Format$(DateSerial(nYear, nMonth, nDay), "short date") & "'" & vbCrLf & vbCrLf
strDisplay = strDisplay & "Day of the week (ISO, U.S., Special) is (" & cDayOfWeek(nYear, nMonth, nDay, True) & ", " & cDayOfWeek(nYear, nMonth, nDay, False) & ", " & cDayOfWeek(nYear, nMonth, nDay, 1) & ") (" & cGetLongDay(LNG_ENGLISH, 1 + cDayOfWeek(nYear, nMonth, nDay, False)) & ")" & vbCrLf
strDisplay = strDisplay & "Day of the year is '" & cDayOfYear(nYear, nMonth, nDay) & "'" & vbCrLf
strDisplay = strDisplay & "Week of the year (ISO, U.S., Special) is (" & cWeekOfYear(nYear, nMonth, nDay, True) & ", " & cWeekOfYear(nYear, nMonth, nDay, False) & ", " & cWeekOfYear(nYear, nMonth, nDay, 1) & ")" & vbCrLf & vbCrLf
nNow = cDateToScalar(nYear, nMonth, nDay)
strDisplay = strDisplay & "Scalar day is '" & nNow & "'" & vbCrLf
Call cScalarToDate(nNow, nYear, nMonth, nDay)
strDisplay = strDisplay & "Year : " & nYear & ", Month : " & nMonth & ", Day : " & nDay & vbCrLf & vbCrLf
nIntNow = cDateToInt(nYear, nMonth, nDay)
strDisplay = strDisplay & "Int day is '" & nIntNow & "'" & vbCrLf
Call cIntToDate(nIntNow, nYear, nMonth, nDay)
strDisplay = strDisplay & "Year : " & nYear & ", Month : " & nMonth & ", Day : " & nDay & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
Call cScalarToDate(nNow, nYear, nMonth, nDay)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerH